<?php
/**
* Loudbite.com Form Elements.
*
*/
class Elements
{
    /**
    * Create email text field
    *
    * @return Zend_Form_Element_Text
    */
    public function getEmailTextField()
    {
        //Create Text Field Object.
        $emailElement = new Zend_Form_Element_Text('email');
        $emailElement->setLabel('Email:');
        $emailElement->setRequired(true);
        //Add Validator
        $emailElement->addValidator(new Zend_Validate_EmailAddress());
        //Add Filter
        $emailElement->addFilter(new Zend_Filter_HtmlEntities());
        $emailElement->addFilter(new Zend_Filter_StripTags());
        return $emailElement;
    }
    /**
    * Create password text field
    *
    * @return Zend_Form_Element_Password
    */
    public function getPasswordTextField()
    {
        //Create Password Object.
        $passwordElement = new Zend_Form_Element_Password('password');
        $passwordElement->setLabel('Password:');
        $passwordElement->setRequired(true);
//        $passwordElement->setObscureValue(true);
        //Add Validator
        $passwordElement->addValidator
        (
        new Zend_Validate_StringLength(6,20)
        );
        //Add Filter
        $passwordElement->addFilter(new Zend_Filter_HtmlEntities());
        $passwordElement->addFilter(new Zend_Filter_StripTags());
        return $passwordElement;
    }
    /**
    * Create username text field.
    *
    * @return Zend_Form_Element_Text
    */
    public function getUsernameTextField()
    {
        $usernameElement = new Zend_Form_Element_Text('username');
        $usernameElement->setLabel('Username:');
        $usernameElement->setRequired(true);
        //Add validator
        $usernameElement->addValidator
        (
        new Zend_Validate_StringLength(6, 20)
        );
        //Add Filter
        $usernameElement->addFilter(new Zend_Filter_StripTags());
        $usernameElement->addFilter(new Zend_Filter_HtmlEntities());
        $usernameElement->addFilter(new Zend_Filter_StringToLower());
        return $usernameElement;
    }

    public function getAboutMeTextArea()
    {
        $textAreaElement = new Zend_Form_Element_Textarea('aboutme');
        $textAreaElement->setLabel('About Me:');
        $textAreaElement->setAttribs(array('cols' => 15,'rows' => 5));
        $textAreaElement->setRequired(true);
        //Add validator
        $textAreaElement->addValidator
        (
        new Zend_Validate_StringLength(6, 20)
        );
        //Add Filter
        $textAreaElement->addFilter(new Zend_Filter_StripTags());
        $textAreaElement->addFilter(new Zend_Filter_HtmlEntities());
        $textAreaElement->addFilter(new Zend_Filter_StringToLower());
        return $textAreaElement;
    }

    public function getHiddenText()
    {
        $textHiddenElement = new Zend_Form_Element_Hidden('OCULTO');
        $textHiddenElement->setLabel('Oculto');
        $textHiddenElement->setRequired(true);
        //Add validator
//        $textHiddenElement->addValidator
//        (
//        new Zend_Validate_StringLength(6, 20)
//        );
//        //Add Filter
//        $textHiddenElement->addFilter(new Zend_Filter_StripTags());
//        $textHiddenElement->addFilter(new Zend_Filter_HtmlEntities());
//        $textHiddenElement->addFilter(new Zend_Filter_StringToLower());
        return $textHiddenElement;
    }

    public function getRadioButton()
    {
        $radioButtonElement = new Zend_Form_Element_Radio('radioButton');
        $radioButtonElement->setLabel('Radio Button');
        $radioButtonElement->addMultiOption('opcion1', 'opcion1');
        $radioButtonElement->addMultiOption('opcion2', 'opcion2');
        $radioButtonElement->addMultiOption('opcion3', 'opcion3');

        $radioButtonElement->setRequired(true);
        //Add validator
        return $radioButtonElement;
    }

    public function getCheckBox()
    {
        $checkBoxElement = new Zend_Form_Element_MultiCheckbox('checkBox');
        $checkBoxElement->setLabel('Check Box');
        $checkBoxElement->addMultiOption('opcion1','opcion1');
//        $checkBoxElement->addMultiOption('opcion2', 'opcion2');
//        $checkBoxElement->addMultiOption('opcion3', 'opcion3');

        $checkBoxElement->setRequired(true);
        //Add validator
        return $checkBoxElement;
    }

}

